package com.lw.smartdevice.controller;

import com.lw.smartdevice.dto.R;
import com.lw.smartdevice.pojo.SysScene;
import com.lw.smartdevice.service.SysSceneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Administrator
 * @version 1.0
 * @description:
 * @date 2022/3/21 21:48
 */
@RestController
@RequestMapping("/scenes")
public class SysSceneController {
    private SysSceneService sysSceneService;

    @Autowired
    public void setSysSceneService(SysSceneService sysSceneService) {
        this.sysSceneService = sysSceneService;
    }

    @PostMapping("/scene")
    public R addScene(@RequestBody SysScene sysScene){
        sysSceneService.addSysScene(sysScene);
        return R.setOK();
    }

    @GetMapping("/scene/{id}")
    public R findById(@PathVariable Long id){
        return R.setOK(sysSceneService.findById(id));
    }
}
